package com.xiaotu.zhouyi.serviceImpl;

import com.xiaotu.zhouyi.pojo.entity.GuaSixtyfour;
import com.xiaotu.zhouyi.mapper.GuaSixtyfourMapper;
import com.xiaotu.zhouyi.service.GuaSixtyfourService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author xiaotu
 * @since 2022-01-13
 */
@Service
public class GuaSixtyfourServiceImpl extends ServiceImpl<GuaSixtyfourMapper, GuaSixtyfour> implements GuaSixtyfourService {
    @Override
    public GuaSixtyfour getById(Serializable id){
        GuaSixtyfour guaSixtyfour = baseMapper.selectById(id);
        String guaXiang = guaSixtyfour.getGuaXiang();
        if(!StringUtils.isEmpty(guaXiang)){
            String[] split = guaXiang.split("=");
            Map<String, String> map = new HashMap();
            map.put("shang", split[0]);
            map.put("xia", split[1]);
            guaSixtyfour.setGuaXiangs(map);
        }
        return guaSixtyfour;
    }


}
